package com.csi.controller;

import com.csi.domain.TravelAttraction;
import com.csi.service.TravelAttractionService;
import com.csi.utils.JsonResult;
import com.csi.utils.ReturnResults;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/travelAttraction")
@Tag(name = "TravelAttractionController",description = "旅游景点相关接口API")
public class TravelAttractionController {

    @Autowired
    private TravelAttractionService travelAttractionService;

    /**
     * 查询热门景点
     * @return
     */
    @Operation(summary = "查询热门景点",description = "查询热门景点")
    @GetMapping("/list")
    public Object list() {
        List<TravelAttraction> list = travelAttractionService.list();
        if (list != null && list.size() > 0) {
            return new JsonResult<>(list);
        }
        return new JsonResult<>(ReturnResults.ACCESS_FAILED,"失败了");
    }
}
